import React from 'react';
import DataTable from 'components/DataTable';
import Icon from 'components/Icon';
import Button from 'components/Button';
import Editor from 'components/Editor';

export default (self, dict) => [
    {
        title: '账号',
        name: 'username',
        tableItem: {},
        searchItem: {
            group: 'abc'
        },
    },
    {
        title: '昵称',
        name: 'nickname',
        tableItem: {},
        searchItem: {
            group: 'abc'
        },
    },
    {
        title: '头像',
        name: 'face_url',
        tableItem: {
            render: (value, record) => {
                return (
                    <DataTable.Oper>
                        {value ?
                            <div style={{ display: 'inline-block' }}>
                                <img src={value} width="40" height="40" />
                            </div>
                            :
                            undefined}
                    </DataTable.Oper>
                )
            }
        },
        formItem: {},
    },
    {
        title: '性别',
        name: 'gender',
        tableItem: {},
    },
    {
        title: '省份',
        name: 'province',
        tableItem: {},
        formItem: {}
    },
    {
        title: '城市',
        name: 'city',
        tableItem: {},
        formItem: {}
    },
    {
        title: '身份',
        name: 'identity_text',
        tableItem: {},
    },
    {
        title: '身份',
        name: 'identity',
        dict: dict.identity,
        formItem: {
            type: 'select',
            rules: [
                {
                    required: true,
                    message: '请选择身份'
                }
            ]
        },
        searchItem: {
            group: 'abc',
            type: 'select'
        },
    },
    {
        title: '操作',
        tableItem: {
            width: 90,
            fixed: 'right',
            render: (text, record) => (
                <DataTable.Oper>
                    <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
                        <Icon type="edit" />
                    </Button>
                    {/* <Button tooltip="删除" onClick={e => self.onDelete(record)}>
                        <Icon type="trash" />
                    </Button> */}
                </DataTable.Oper>
            )
        }
    }
];
